package com.wanxi.user.api;

import com.wanxi.user.domain.dto.DelShoppingCartDto;
import com.wanxi.user.domain.dto.ShoppingCartDto;
import com.wanxi.user.domain.entity.ShoppingCart;
import com.wanxi.user.domain.result.UserResult;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author:Iny
 * @Data：2022/1/10 13:32
 */
@FeignClient(value = "user",path = "/back/shoppingCart")
public interface ShoppingCartFeign {

    @ApiOperation(value = "添加商品到购物车")
    @PostMapping("addCartProduct")
    UserResult<Long> addCartProduct(@RequestBody ShoppingCartDto productCartDto) ;

    @ApiOperation(value = "删除购物车商品")
    @ApiImplicitParam(name = "shopping", value = "用户id和商品skuId", dataType = "long", required = true)
    @PutMapping("delCartProduct")
    UserResult<String> delShoppingCartByUserIdAndSkuId(@RequestBody DelShoppingCartDto delShoppingCartDto) ;

    @ApiOperation(value = "清空购物车商品")
    @ApiImplicitParam(name = "userId", value = "用户id", dataType = "long", required = true)
    @PutMapping("delCartProductAll")
    UserResult<Boolean> delCartProductAll(@RequestParam("userId")long userId);

    @ApiOperation(value = "查看购物车商品")
    @ApiImplicitParam(name = "userId", value = "用户id", dataType = "long", required = true)
    @GetMapping("findCartProduct")
    UserResult<List<ShoppingCart>> findCartProduct(@RequestParam("userId") long userId);
}
